package com.iotek.bookstore.util;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class ConnectionFactory {
	private static String DRIVER;
	private static String URL;
	private static String UNAME;
	private static String UPASS;

	static {

			DRIVER = "com.mysql.jdbc.Driver";
			URL = "jdbc:mysql://localhost:3306/bookstore"
                + "?user=root&password=root&useUnicode=true&characterEncoding=UTF8";
			UNAME = "root";
			UPASS = "1234";

	}

	public static Connection getConnection() {
		Connection conn = null;
		try {
			Class.forName(DRIVER);
			conn = DriverManager.getConnection(URL, UNAME, UPASS);
		} catch (Exception e) {
			e.printStackTrace();
		}
		//System.out.println(conn);
		return conn;
	}
}
